package com.mbiolance.cloud.activiti.rpc;

import com.mbiolance.cloud.activiti.domain.dto.ModelDto;
import com.mbiolance.cloud.activiti.domain.dto.ProcessDefinitionDto;
import com.mbiolance.cloud.auth.domain.PageModel;
import com.mbiolance.cloud.auth.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "流程定义相关接口")
@FeignClient(contextId = "ProcessDefinition", value = "mbiolance-service-activiti", path = "/process-definition"
        , configuration = FeignConfiguration.class)
public interface ProcessDefinitionFeignService {

    @ApiOperation("获取流程定义列表")
    @GetMapping("list")
    R<List<ProcessDefinitionDto>> list();

    @ApiOperation("获取流程定义的分页列表")
    @GetMapping("page")
    R<PageModel<ProcessDefinitionDto>> page(@RequestParam(required = false, defaultValue = "1") Integer number
            , @RequestParam(required = false, defaultValue = "10") Integer size);

    @ApiOperation("部署流程模型")
    @PutMapping("deploy/{modelId}")
    R<Boolean> deploy(@PathVariable String modelId);

    @ApiOperation("获取流程模型设计的分页列表")
    @GetMapping("model-page")
    R<PageModel<ModelDto>> modelPage(@RequestParam(required = false, defaultValue = "1") Integer number
            , @RequestParam(required = false, defaultValue = "10") Integer size);

    @ApiOperation("删除流程模型")
    @DeleteMapping("del-model/{modelId}")
    R<Boolean> deleteModel(@PathVariable String modelId);

}
